﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;

namespace DATA
{
    public class PartnerREP
    {
        MODELGENERALDataContext context = new MODELGENERALDataContext();


        public List<PartnerDTO> GetAllPartners()
        {
            List<PartnerDTO> acc = new List<PartnerDTO>();

            var acounts = from a in context.Partners
                          select a;
            foreach (var account in acounts)
            {
                PartnerDTO part = new PartnerDTO();
                part.Avatar = account.avatar;
                part.Company = account.company;
                part.IsActived = account.isActived;
                part.Link = account.link;
                part.PartnerID = account.partnerID;
                acc.Add(part);
            }
            return acc;
        }

        public List<PartnerDTO> GetActivePartner()
        {
            List<PartnerDTO> acc = new List<PartnerDTO>();

            var acounts = from a in context.Partners
                          where a.isActived==true
                          select a;
            foreach (var account in acounts)
            {
                PartnerDTO part = new PartnerDTO();
                part.Avatar = account.avatar;
                part.Company = account.company;
                part.IsActived = account.isActived;
                part.Link = account.link;
                part.PartnerID = account.partnerID;
                acc.Add(part);
            }
            return acc;
        }

    }
}
